#pragma once
#include "genx.h"

class XmlSaxSender
{
public:
	virtual genxStatus Send(constUtf8 s,int len)=0;
	virtual genxStatus Flush() {
		return GENX_SUCCESS;
	}
};

class XmlSaxWriter
{
public:
	XmlSaxWriter(XmlSaxSender* sender);
	XmlSaxWriter(FILE* sender);
	~XmlSaxWriter();

	genxStatus EndDocument();
	genxStatus Comment(const char* text);

	genxStatus StartElement(const char* xmlns, const char* type);

	genxStatus AddAttribute(const char* xmlns, const char* name, const char* value);
	genxStatus EndElement();
	genxStatus AddText(const char* start, int byteCount);
	const char* LastError();

private:
	genxWriter m_writer;
	XmlSaxSender* m_sender;
	genxSender m_genxSender;
};

